updating oE sign

sign

include math.e 
namespace math 
public function sign(object a) 

returns -1, 0 or 1 for each element according to it being negative, zero or positive.

Parameters:
  1. value : an object, each atom of which will be acted upon, no matter how deeply nested.
Returns:

An object, the same shape as value. When value is an atom, the result is -1 if value is less than zero, 1 if greater and 0 if equal.

Comments:

This function may be applied to an atom or to all elements of a sequence.

For an atom, sign(x) is the same as compare(x,0).

Example 1:
i = sign(5) 
i is 1 
 
i = sign(0) 
-- i is 0 
 
i = sign(-2) 
-- i is -1 
See Also:

compare

Not Categorized, Please Help

Search



Quick Links

User menu

Not signed in.

Misc Menu